/**
 * 
 */
package com.rio.dandan.dao.impl;

import java.util.List;

import com.rio.dandan.dao.DaoSupport;
import com.rio.dandan.dao.UserProfileDao;
import com.rio.dandan.pojo.UserProfile;

/**
 * 
 * UserProfileDaoImpl.java
 * 
 * @author 宋陆
 * @version 1.0 2014年5月18日
 */
public class UserProfileDaoImpl extends DaoSupport implements UserProfileDao {

    /**
     * @see com.rio.dandan.dao.UserProfileDao#getUserProfile(java.lang.String)
     */
    @Override
    public UserProfile getUserProfile(String uid) {
        return super.get(UserProfile.class, uid, true);
    }

    /**
     * @see com.rio.dandan.dao.UserProfileDao#addUserProfile(com.rio.dandan.pojo.UserProfile)
     */
    @Override
    public UserProfile addUserProfile(UserProfile userProfile) {
        super.save(userProfile);
        return userProfile;
    }

    /**
     * @see com.rio.dandan.dao.UserProfileDao#updateUserProfile(com.rio.dandan.pojo.UserProfile)
     */
    @Override
    public UserProfile updateUserProfile(UserProfile userProfile) {
        super.update(userProfile);
        return userProfile;
    }

    /**
     * @see com.rio.dandan.dao.UserProfileDao#findUserProfile(java.lang.String[])
     */
    @Override
    public List<UserProfile> findUserProfile(String[] ids) {
        if (ids == null || ids.length == 0) {
            return null;
        }
        String nativeSql = "select * from user_profile where uid in (:ids)";
        String[] names = new String[] { "ids" };
        Object[] params = new Object[] { ids };
        return super.findByNativeSql(nativeSql, names, params, UserProfile.class);
    }

}
